package com.ehotting.edsta.csharpServer.service;

import com.ehotting.eaf.core.domain.R;
import com.ehotting.eaf.core.domain.csharpServer.LicenseApplyVo;
import com.ehotting.eaf.core.domain.csharpServer.LicenseSignedDto;
import com.ehotting.eaf.core.domain.system.api.UserLicense;

import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

/**
 * C端用户licenseService接口
 * 
 * @author edsta
 * @date 2023-03-24
 */
public interface IUserLicenseService 
{
    /**
     * 查询C端用户license
     * 
     * @param id C端用户license主键
     * @return C端用户license
     */
    UserLicense selectUserLicenseById(Long id);

    /**
     * 新增C端用户license
     * 
     * @param userLicense C端用户license
     * @return 结果
     */
    int insertUserLicense(UserLicense userLicense);

    /**
     * 生成license的业务逻辑处理
     * @param licenseApplyVo
     * @return
     */
    void generateLicense(LicenseApplyVo licenseApplyVo) throws NoSuchAlgorithmException;

    /**
     * 校验license的业务逻辑处理
     * @param licenseApplyVo
     * @return
     */
    R<LicenseSignedDto> licenseVerify(LicenseSignedDto licenseApplyVo) throws NoSuchPaddingException, NoSuchAlgorithmException, IllegalBlockSizeException, BadPaddingException, InvalidKeyException, InvalidKeySpecException;

    Boolean isApplied();

    void licenseExtend(LicenseSignedDto licenseApplyVo);
}
